#/*HEADER*******************************************************************
#***************************************************************************
#***
#***     Copyright (c) 2002 Sandbridge Technologies, Inc.
#***
#***                     All rights reserved
#***
#*** This software embodies materials and concepts which are confidential
#*** to Sandbridge Technologies, Inc. and is made available
#*** solely pursuant to the terms of a written license agreement with
#*** Sandbridge Technologies, Inc.
#***************************************************************************
#*END*************************************************************************/

# To activate files I/O for validation of UL vs. MatLab must '#define UL_VALIDATION'

#RPU_FLAGS=$(SBCCFLAGS)#modifi 627
RPU_FLAGS=--march=sb3500

BOARD_FLAGS= -DTPU_MHZ=125 -DSCALE_ADC -DRUN_ON_BOARD -DSAMSUNG_RF -D__SANDBLASTER__
#-DREDUCE_FREQUENCY_RX

#-DPHY_RX_CYCLE_PRINT_11 -DPHY_RX_CYCLE_PRINT_55
#-DPHY_RX_CYCLE_PRINT
#-DPHY_RX_CYCLE_PRINT
#-DHSN_FREQUENCY

BUILD_DIR = .

SRC_DIR_RX = $(BUILD_DIR)/Source_files


INCLS	= -I$(BUILD_DIR)/Header_files -I../../Common_Header_files \
	-I../Common_Phy_Header_files \
	-I../../MAC/Header_files -I../Transmit/Header_files \
	-I../../RF/Headers  \
	-I../Loop/header \
	-I../Turbo_Test/Includes
#	-I../../Rf_AD9361_3500/Header_files
#-I../../Rf_2829_3500/Header_files


RXCSRCS = FnThread1.c FnThread3.c FnThread2.c \
	rx_functions.c rx55_functions.c rx2_functions.c rx1_functions.c \
	training.c sfd_header.c correlation.c \
	rxtables.c rx11_functions.c copy_wrap.c eqref.c \
	thread_globals.c create_rxthreads.c L1Ctrl.c timer1.c protocol.c \
	conv_decoder.c \
	threadutil.c \
	dl_turbo.c turbo_common.c turbo_test.c turbo_interleave_utils.c\
	turbo_unwraped.c \
#	ber_test.c \
	
	


CSRCS = $(RXCSRCS)

		
RM	= rm -f
EXT	= .a
PROGRAM	= wlan_rx${EXT}


OBJS 	= $(CSRCS:.c=.o) fir_asm.o cck_55_rpu_asm.o equalizer.o \
	preamblesync_asm.o correlation_asm.o derotate_asm.o \
	equalizer_asm.o derotate1_asm.o cck_opt_asm.o demod55_asm.o \
	demod11_asm.o correlation.o \
	conv_decoder.o \
	threadutil.o \
	dl_turbo.o turbo_common.o turbo_test.o turbo_interleave_utils.o\
	turbo_unwraped.o \

	
	
	

CC	= "$(SBROOT)/bin/sbcc"
AS	= "$(SBROOT)/bin/sb-as"
AR	= "$(SBROOT)/bin/sb-ar"
CPPASM  = cpp -x assembler-with-cpp -traditional -nostdinc


CFLAGS= $(INCLS) \
	$(BOARD_FLAGS) \
	-O3 \
	--inline \
	--restrict \
	--noclean
#-ddmode

#-dvectinfo
#-v


default:	$(PROGRAM)

all:	$(PROGRAM)

$(PROGRAM): $(OBJS)
	$(AR) rf $@ $^

%.o: $(SRC_DIR_RX)/%.SS
	$(CPPASM) -I$(SBROOT)/include $< | $(AS) -o $@

%.o: $(SRC_DIR_RX)/%.c
	$(CC) -o $@ -c $(RPU_FLAGS) $(CFLAGS) $<
	


clean:
	$(RM) $(OBJS) *.stackdump $(PROGRAM) *~
	$(RM) *.s *.v *.o *.sbx *.nm *.dis
	$(RM) filteredOut.txt iqout.txt testout.txt

clobber: clean
	$(RM) profile.*
